﻿<%@Page Title="" Language="C#" AutoEventWireup="true" ValidateRequest="false" MasterPageFile="~/Plantillanoheader.master" CodeFile="GestionarComentarios.aspx.cs" Inherits="PagAdmin_GestionarComentarios" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headerslider" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyprincipal" Runat="Server">
<h3>Gestionar Comentarios</h3>
   <p></p>
   <h4 class="txt1">Comentarios por página:</h4>
   <asp:DropDownList CssClass="genselect" ID="ddlCommentsPerPage" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCommentsPerPage_SelectedIndexChanged">
      <asp:ListItem Value="5">5</asp:ListItem>
      <asp:ListItem Value="10">10</asp:ListItem>
      <asp:ListItem Value="25" Selected="True">25</asp:ListItem>
      <asp:ListItem Value="50">50</asp:ListItem>   
      <asp:ListItem Value="100">100</asp:ListItem>
   </asp:DropDownList>
   <p></p>
   <asp:GridView ID="gvwComments" runat="server"  AllowPaging="True" AutoGenerateColumns="False"
      DataKeyNames="ID" DataSourceID="objComments" PageSize="25" ShowHeader="False"
      EmptyDataText="<b>No hay comentarios para mostrar</b>" 
        OnRowCreated="gvwComments_RowCreated" 
        OnPageIndexChanged="gvwComments_PageIndexChanged" 
        OnRowDeleted="gvwComments_RowDeleted" 
        OnSelectedIndexChanged="gvwComments_SelectedIndexChanged" CellPadding="10" 
        CellSpacing="10">
      <Columns>
         <asp:TemplateField HeaderStyle-HorizontalAlign="Left">
            <ItemTemplate>
               <div class="comment">
               <b>Comentario publicado por
               <asp:HyperLink ID="lnkAddedBy" runat="server" Text='<%# Eval("Usuario") %>'
                  NavigateUrl='<%# "mailto:" + Eval("mail_usua_come") %>' />
               el <asp:Literal ID="lblAddedDate" runat="server" Text='<%# Eval("Fecha", "{0:f}") %>' />
               <br />Articulo: </b>
<%--               <asp:HyperLink runat="server" ID="lnkArticle" Text='<%# Eval("titu_arti") %>'
                  NavigateUrl='<%# "~/ShowArticle.aspx?ID=" + Eval("Id_articulo") %>' />--%>
               <br />               
               <asp:Literal ID="lblBody" runat="server" Text='<%# Eval("EncodedBody") %>' />         
               </div>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Edit.gif" SelectText="Update category" ShowSelectButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
         <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/Delete.gif" DeleteText="Delete category" ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
      </Columns>
      <EmptyDataTemplate><b>No hay comentarios para mostrar</b></EmptyDataTemplate>   
   </asp:GridView>
   <asp:ObjectDataSource ID="objComments" runat="server" DeleteMethod="DeleteComment"
      SelectMethod="GetComments" SelectCountMethod="GetCommentCount" 
        EnablePaging="true" TypeName="IUAP.BLL.Articulo.Comentario">
      <DeleteParameters>
         <asp:Parameter Name="Id" Type="Int32" />
      </DeleteParameters>
   </asp:ObjectDataSource>
   <p></p>
   <div class="boxcoment" id="boxcomment">
   <asp:DetailsView id="dvwComment" runat="server" AutoGenerateEditButton="True" 
      HeaderText="Editar Comentario" AutoGenerateRows="False" DataSourceID="objCurrComment" 
      OnItemCommand="dvwComment_ItemCommand" DataKeyNames="ID" 
        OnItemUpdated="dvwComment_ItemUpdated"   BorderStyle="None" HeaderStyle-CssClass="txt2" RowStyle-CssClass="boxcomenttr">
      <FieldHeaderStyle Width="80px" />      
      <Fields>
         <asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="True" >         
         <ControlStyle BorderStyle="None" CssClass="boxcomenttr" />
          <FooterStyle BorderStyle="None" />
          <HeaderStyle BorderStyle="None" />
          <ItemStyle BorderStyle="None" />
          </asp:BoundField>
         <asp:BoundField DataField="Fecha" HeaderText="Fecha" ReadOnly="True">
         <ControlStyle BorderStyle="None" CssClass="boxcomenttr" />
          <FooterStyle BorderStyle="None" />
          <HeaderStyle BorderStyle="None" />
          <ItemStyle BorderStyle="None" />
          </asp:BoundField>
         <asp:HyperLinkField DataNavigateUrlFormatString="mailto:{0}" DataNavigateUrlFields="Mail_usua_come"
            DataTextField="Usuario" HeaderText="Usuario" />
         <asp:TemplateField HeaderText="Comentario">
            <ItemTemplate>
               <asp:Label ID="lblBody" runat="server" Text='<%# Eval("Cont_come") %>' />
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtBody" runat="server" Text='<%# Bind("Cont_come") %>' TextMode="MultiLine" Rows="5" Width="100%"></asp:TextBox>
               <asp:RequiredFieldValidator ID="valRequireBody" runat="server" ControlToValidate="txtBody" SetFocusOnError="true"
                  Text="El texto del comentario es necesario." ToolTip="El texto del comentario es necesario." Display="Dynamic"></asp:RequiredFieldValidator>
            </EditItemTemplate>
            <ControlStyle BorderWidth="0px" BorderStyle="None"></ControlStyle>
<FooterStyle BorderWidth="0px" BorderStyle="None"></FooterStyle>
<HeaderStyle BorderWidth="0px" BorderStyle="None" CssClass="txt1"></HeaderStyle>
<ItemStyle BorderStyle="None" CssClass="boxcomenttr"/>
         </asp:TemplateField>
      </Fields>
   </asp:DetailsView>
   </div>
   <asp:ObjectDataSource ID="objCurrComment" runat="server"
      SelectMethod="GetCommentByID" TypeName="IUAP.BLL.Articulo.Comentario"
      UpdateMethod="UpdateComment">
      <UpdateParameters>
         <asp:Parameter Name="id" Type="Int32" />
         <asp:Parameter Name="cont_come" Type="String" />
      </UpdateParameters>
      <SelectParameters>
         <asp:ControlParameter ControlID="gvwComments" Name="id_comentario" PropertyName="SelectedValue" Type="Int32" />
      </SelectParameters>
   </asp:ObjectDataSource>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="titulocolum" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="bodycolleft" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="bodycolright" Runat="Server">
</asp:Content>
